const C = require('memory-cache')

const mock_shops = [{ 'id': '0', shop: 'kobako', pass: '123', 'name': 'kobako', 'desc': 'kobako的店铺' }, { 'id': '1', 'name': '学校饭堂', pass: '123', 'desc': '电科大学校饭堂', shop: 'school' },]

const mock_foods = [{
  id: 0,
  shop_id: 0,
  name: '鱼香豆腐',
  price: 12,
  desc: '很好吃的鱼香豆腐',
}, {
  id: 1,
  shop_id: 1,
  name: '红烧排骨',
  price: 13,
  desc: '很好吃的红烧排骨',
}, {
  id: 2,
  shop_id: 1,
  name: '路过的肥宅',
  price: 11,
  desc: '很好吃的路过的肥宅',
}, {
  id: 3,
  shop_id: 0,
  name: '时菜炒肉片',
  price: 12,
  desc: '补充多种蔬菜',
}]

const mock_users = [
  { id: 0, name: 'kobako', user: 'kobako', pass: '123' }
]

const mock_orders = [{
  id: 0,
  user_id: 0,
  food_id: 0,
  time: '2018-6-11 10:30:00',
  status: 0 //0 未接单 1 已接单 2 已完成订单 3 已退单 
}, {
  id: 1,
  user_id: 0,
  food_id: 1,
  time: '2018-6-11 9:30:00',
  status: 3 //0 未接单 1 已接单 2 已完成订单 3 已退单
}]


module.exports = {
  init: () => {
    console.log('初始化内存数据库')
    C.put('shops', mock_shops)
    C.put('foods', mock_foods)
    C.put('users', mock_users)
    C.put('orders', mock_orders)
  }
}